Next.js - FQ
How to use cssModules
1 | # install next-css |
How to listen for routing changes?
The router of next provide some APIs that are used to listen for routing changes for us. For example: beforeHistoryChange, routeChangeComplete...
1 | // _app.js |
The solution of ant-design
in the development environment style load is incomplete.
1 | // next.config.js |
The solution of min-css-extract-plugin
warning in the console
1 | chunk commons [mini-css-extract-plugin] |
// next.config.js
1 | // define the webpack plugn |
How to polyfill IE10/IE9 in this scaffold?
Add polyfills.js in your project.
1 | // /core/polyfills.js |
How to alias folder path?
1 | // next.config.js |
Config the next.config.js
1 | // next.config.js |
Downgrade your Next version to ‘7.0.2’
The ant-design style flash when page refresh!
1 | // _app.js -> getInitialProps |
How to speed up packing in production?
1. tenser-webpack-plugin -> cache
1 | new TerserPlugin({ |
2. Add thread-loader
1 | config.module.rules.push({ |
How to optimize bundle size?
Optimize moment local.
1 | // next.config.js |
Optimize antd icon dist.
1 | // next.config.js |
1 | const fs = require("fs"); |
Thanks: luffyZh update FAQ